#pragma once

#include "public/build.h"
#include "core/kobject.h"
#include "image/image.h"

namespace renderit
{
	namespace graphics
	{
		enum ETextureUsage
		{
			ETexture_UsageNone,
			ETexture_DepthStencil,
			ETexture_ShaderInput,
			ETexture_FrameBuffer
		};

		struct texture_desc
		{
			uint32 width;
			uint32 height;
			uint32 format;

			ETextureUsage usage;
			uint8 mip_levels;

			texture_desc() : width(0), height(0), format(0), usage(ETexture_UsageNone), mip_levels(0) {}
			texture_desc(const texture_desc& desc)
			{
				this->operator=(desc);
			}

			texture_desc& operator = (const texture_desc& other)
			{
				width = other.width;
				height = other.height;
				format = other.format;
				usage = other.usage;
				mip_levels = other.mip_levels;
				return *this;
			}
		};

		class itexture : public core::kobject
		{
		public:
			virtual ~itexture() {}

		public:
			const texture_desc& get_desc() const { return desc_; }

		public:
			uint32 get_width() const { return desc_.width; }
			uint32 get_height() const { return desc_.height; }

		public:
			bool is_depthstencil() const { return desc_.usage == ETexture_DepthStencil; }
			bool is_shaderinput() const { return desc_.usage == ETexture_ShaderInput; }
			bool is_framebuffer() const { return desc_.usage == ETexture_FrameBuffer; }

		protected:
			texture_desc desc_;
		};

		typedef core::ref_ptr<itexture> itexture_ptr;
	}
}